package com.app.service.impl;

import com.app.mapper.ReportMsgMapper;
import com.app.model.JobFairSceneModel;
import com.app.model.ReportMsgModel;
import com.app.service.ReportMsgService;
import com.app.util.StringTool;
import com.app.vo.JobFairSceneVo;
import com.app.vo.ReportMsgVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.List;


/**
 * @Description:举报内容
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
public class ReportMsgServiceImpl implements ReportMsgService {

    @Autowired
    ReportMsgMapper reportMsgMapper;


    @Override
    public int insert(ReportMsgModel model) {
        return reportMsgMapper.insert(model);
    }

    @Override
    public Page<ReportMsgModel> getList(ReportMsgModel model) {
        QueryWrapper<ReportMsgModel> queryWrapper = new QueryWrapper<>();

        if(StringTool.isNotEmpty(model.getStartTime()))
        {
            queryWrapper.ge("crt_time",model.getStartTime());
        }
        if(StringTool.isNotEmpty(model.getEndTime()))
        {
            queryWrapper.le("crt_time",model.getEndTime());
        }
        queryWrapper.orderByDesc("crt_time");
        Page<ReportMsgModel> page = new Page<>();
        page.setCurrent(model.getPage());
        page.setSize(model.getLimit());
        Page<ReportMsgModel> jobFairSceneModelPage = reportMsgMapper.selectPage(page,queryWrapper);
        if (jobFairSceneModelPage==null) {
            return null;
        } else {
            return jobFairSceneModelPage;
        }
    }
}
